
#build stage
FROM golang:1.13.8 AS build-env
ADD . /micro-gateway
WORKDIR /micro-gateway
ENV GOOS linux
ENV GOARCH amd64
ENV CGO_ENABLED=0
ENV GOFLAGS "-ldflags=-w -ldflags=-s"
ENV GO111MODULE=on
ENV GOFLAGS=" -mod=vendor"
ENV GOPROXY=https://yz271544:UbFWoA20KLRShpM@goproxy.io,direct
RUN go build -o /brun brun/main.go

#final stage
FROM debian:buster
LABEL Name=micro-gateway Version=0.0.1
EXPOSE 18081
WORKDIR /
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
    && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
RUN apt-get install -y coreutils
COPY --from=build-env /micro-gateway/config /config
COPY --from=build-env /brun /
RUN chmod +x /brun
CMD ["/brun"]

